<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'workflow.label', default: 'Workflow')}"/>
    <title>工作流</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>工作流</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                工作流
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row">
        <g:form method="POST" action="index" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" onclick="text()"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i class="fa fa-times"></i> 重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group">
                    <div class="row">
                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">名称</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="name" id="name" value="${params?.name}" placeholder="请输入名称">
                            </div>
                        </div>

                        <div class="form-group col-sm-3">
                            <label class="col-sm-3 control-label">类型</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="type" id="type" from="${com.cindata.dictionary.WorkflowType.list()}" valueMessagePrefix="status" optionKey="id" optionValue="name"
                                        value="${params?.type}" noSelection="${['': '请选择类型']}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <sec:ifNotGranted roles="ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE">
                    <g:link class="btn btn-info btn-xs" controller="Workflow" action="create"><i
                            class="fa fa-plus"></i>新增</g:link>
                        </sec:ifNotGranted>
                </div>
                工作流
            </div>
            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover text-center">
                        <thead>
                        <tr>
                            <g:sortableColumn property="name" title="${message(code: 'opportuniryWorkflow.name.label', default: '名称')}"/>
                            <g:sortableColumn property="code" title="${message(code: 'opportuniryWorkflow.name.label', default: '编码')}"/>
                            <g:sortableColumn property="type" title="${message(code: 'opportuniryWorkflow.type.name.label', default: '类型')}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${workflowList}">
                            <tr>
                                <td><g:link controller="workflow" action="show" id="${it?.id}">${it?.name}</g:link></td>
                                <td>${it?.code}</td>
                                <td>${it?.type?.name}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate action="index" total="${workflowCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>

<g:javascript>
        
    //重置按钮
    $("#resetBtn").click(function () {
        $("#name").val("");
        $("#s2id_type span:first").html("请选择类型");
        $("#type").val("");
    });

</g:javascript>

</body>
</html>
